import configparser
import os

class Config(configparser.RawConfigParser):
    def __init__(self,fileName,postfix="cfg"):
        self.__fileName="{}.{}".format(fileName,postfix)
        if(not os.path.exists(self.__fileName)):
            open(self.__fileName,"a").close()
        super().__init__()
        self.read(self.__fileName,"utf-8")
    def set(self,section, option, value=None):
        if(not self.has_section(section)):
            self.add_section(section)
        super().set(section, option, value)
    def save(self):
        with open(self.__fileName, 'w') as configfile:
            self.write(configfile)
